package cn.itcast.controller;

import cn.itcast.pojo.ClazzOption;
import cn.itcast.pojo.JobOption;
import cn.itcast.pojo.Result;
import cn.itcast.service.ReportService;
import cn.itcast.service.StudentService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

@RestController
@Slf4j
@RequestMapping("/report")
public class ReportController {
    @Autowired
    private ReportService reportService;
    @Autowired
    private StudentService studentService;


    /*统计员工职位*/
    @GetMapping("/empJobData")
    public Result empJobData(){
        JobOption jobOption =  reportService.empJobData();
        return Result.success(jobOption);
    }

    /*统计员工性别*/
    @GetMapping("empGenderData")
    public Result empGenderData(){
       List<Map<String, Object>>  mapList = reportService.empGenderData();
        return Result.success(mapList);
    }
    /*统计班级人数*/
    @GetMapping("/studentCountData")
    public Result studentCountData(){
        ClazzOption clazzOption = studentService.studentCountData();
        return Result.success(clazzOption);

    }

    /*统计学院的学历*/
    @GetMapping("/studentDegreeData")
    public Result studentDegreeData(){
        List<Map> mapList = studentService.studentDegreeData();
        return Result.success(mapList);
    }
}
